//获取当前时间（XXXX-XX-XX）
export function getCurDate() {
    const now = new Date();
    let year = now.getFullYear();
    let month = now.getMonth() + 1;
    let day = now.getDate();
    let hour = now.getHours();
    let minute = now.getMinutes();
    let second = now.getSeconds();
    
    return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
}
//向sessionStorage中存储一个JSON对象
export function setSessionStorage(key, value) {
    sessionStorage.setItem(key, JSON.stringify(value));
}
//从sessionStorage中获取一个JSON对象（取不到时返回null）
export function getSessionStorage(key) {
    const value = sessionStorage.getItem(key);
    return value ? JSON.parse(value) : null;
}
//从sessionStorage中移除一个JSON对象
export function removeSessionStorage(key) {
    sessionStorage.removeItem(key);
}
//向localStorage中存储一个JSON对象
export function setLocalStorage(key, value) {
    localStorage.setItem(key, JSON.stringify(value));
}
//从localStorage中获取一个JSON对象（取不到时返回null）
export function getLocalStorage(key) {
    const value = localStorage.getItem(key);
    return value ? JSON.parse(value) : null;
}
//从localStorage中移除一个JSON对象
export function removeLocalStorage(key) {
    localStorage.removeItem(key);
}